Skip to content

fix(sort): always install SIGINT handler to ensure temp dir cleanup#11889

Merged
sylvestre merged 1 commit into
uutils:mainfrom
mattsu2020:sort_fix2
Apr 18, 2026
Merged

fix(sort): always install SIGINT handler to ensure temp dir cleanup#11889
sylvestre merged 1 commit into
uutils:mainfrom
mattsu2020:sort_fix2

Conversation

@mattsu2020
Copy link
Copy Markdown
Contributor

@mattsu2020 mattsu2020 commented Apr 17, 2026

Summary

The should_install_signal_handler() check added in 87c332c72 skipped SIGINT handler installation on systems with many open FDs, meaning Ctrl+C left /tmp/uutils_sortXXXX directories behind with no cleanup at all.

Now the handler is always attempted; ctrlc::set_handler failing naturally is sufficient. Failure is treated as non-fatal.

Root Cause

Scenario Before this fix After
Ctrl+C (high FDs) No handler installed → no cleanup Handler always attempted
Ctrl+C (normal) remove_tmp_direxit(2) Same (already worked)
Normal exit TempDir::Drop Same (no change)

On Ubuntu 26.04 and systems with many open FDs, the SIGINT handler was never installed, so every interrupted sort leaked its temp directory.

Test

  • cargo check -p uu_sort passes
  • cargo test -p uu_sort — all 28 tests pass

Closes: #11728
We will also address the PR below and close the issue.
#11888

The `should_install_signal_handler()` check added in 87c332c skipped
handler installation on systems with many open FDs, meaning Ctrl+C left
`/tmp/uutils_sortXXXX` directories behind with no cleanup at all.

Now the handler is always attempted; `ctrlc::set_handler` failing
naturally is sufficient. Failure is treated as non-fatal.

Closes: uutils#11728
@mattsu2020 mattsu2020 changed the title fix(sort): always install SIGINT handler and explicitly clean up temp dir fix(sort): always install SIGINT handler to ensure temp dir cleanup Apr 17, 2026
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.
Skip an intermittent issue tests/cut/bounded-memory (was skipped on 'main', now failing)

@xtqqczze

This comment was marked as resolved.

@sylvestre sylvestre merged commit c1631da into uutils:main Apr 18, 2026
169 checks passed
@mattsu2020 mattsu2020 deleted the sort_fix2 branch April 19, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sort is filling /tmp with uutils_sortXXXX directories

3 participants